using System;
using System.Collections;
using FlowCanvas;
using FlowCanvas.Nodes;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;

namespace Yoozoo.Gameplay.Liberty.Nodes
{
    public class SwitchCityBusinessState: FlowControlNode
    {
        public enum CityBusinessState
        {
            CanOpen = 0,
            Opening = 1,
            CanClose = 2,
        }
        
        [RequiredField]
        public BBParameter<CityBusinessState> state; //状态
        
        protected override void RegisterPorts()
        {
            var caseTrue = AddFlowOutput("True");
            var caseFalse = AddFlowOutput("False");
            var caseThen = AddFlowOutput("Then");
            AddFlowInput("In", (f) =>
            {
                bool passed = BlueprintUtils.IsCityBusinessStateMatch((int)state.value);
                if (passed)
                {
                    f.Call(caseTrue);
                }
                else
                {
                    f.Call(caseFalse);
                }
                
                f.Call(caseThen);
            });

        }
    }
}